package com.mayjean.common.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.mayjean.common.util.JsonUtil;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * Jackson2 configuration
 *
 * @author kyleju
 */
@Configuration
@AutoConfigureAfter({JacksonAutoConfiguration.class})
@Import(JacksonAutoConfiguration.class)
public class Jackson2Configuration {
	@Bean
	@ConditionalOnMissingBean
	public ObjectMapper objectMapper() {
		ObjectMapper objectMapper = JsonUtil.getObjectMapperInstance();
		return JsonUtil.setJsonObjectMapperParams(objectMapper);
	}
}
